/*********************************************************************************************************************
 * COPYRIGHT NOTICE
 * Copyright (c) 2018,逐飞科技
 * All rights reserved.
 * 技术讨论QQ群：		一群：179029047(已满)
 *					二群：244861897(已满)
 *					三群：824575535
 *
 * 以下所有内容版权均属逐飞科技所有，未经允许不得用于商业用途，
 * 欢迎各位使用并传播本程序，修改内容时必须保留逐飞科技的版权声明。
 *
 * @file			seekfree_sht31.h
 * @company			成都逐飞科技有限公司
 * @author			逐飞科技(QQ3184284598)
 * @version			查看doc内version文件 版本说明
 * @Software		IAR 8.3 or MDK 5.24
 * @Taobao			https://seekfree.taobao.com/
 * @date			2020-03-25
 * @note			本文件作为IOT开发板 seekfree_sht31 传感器 API
 ********************************************************************************************************************/

#ifndef _SEEKFREE_SHT31_H_
#define _SEEKFREE_SHT31_H_

#ifdef IOT_BOARD
#include "iot_flexcomm_iic.h"
#else
#include "zf_iic.h"
#endif

#define	SHT31_DEFAULT_ADDR				0x44
//#define	SHT31_MEAS_LOWREP_STRETCH		0x2C10
//#define	SHT31_MEAS_MEDREP_STRETCH		0x2C0D
//#define	SHT31_MEAS_HIGHREP_STRETCH		0x2C06
//#define	SHT31_MEAS_LOWREP				0x2416
//#define	SHT31_MEAS_MEDREP				0x240B
#define	SHT31_MEAS_HIGHREP				0x2400
//#define	SHT31_CLEARSTATUS				0x3041
#define	SHT31_SOFTRESET					0x30A2
#define	SHT31_HEATEREN					0x306D
#define	SHT31_HEATERDIS					0x3066
#define	SHT31_READSTATUS				0xF32D

#ifdef IOT_BOARD
void		sht31_write_cmd			(iot_flexcomm_index_list Index, uint16_t cmd);
void		sht31_reset				(iot_flexcomm_index_list Index);
void		sht31_init				(iot_flexcomm_index_list Index);
uint16_t	sht31_read_status		(iot_flexcomm_index_list Index);
void		sht31_heater			(iot_flexcomm_index_list Index, bool enable);
uint8_t		sht31_crc8				(const uint8_t *data, uint8_t len);
bool		sht31_read_temp_hum		(iot_flexcomm_index_list Index);
float		sht31_read_temperature	(iot_flexcomm_index_list Index);
float		sht31_read_humidity		(iot_flexcomm_index_list Index);
#else
void		sht31_write_cmd			(flexcomm_index_list Index, uint16_t cmd);
void		sht31_reset				(flexcomm_index_list Index);
void		sht31_init				(flexcomm_index_list Index);
uint16_t	sht31_read_status		(flexcomm_index_list Index);
void		sht31_heater			(flexcomm_index_list Index, bool enable);
uint8_t		sht31_crc8				(const uint8_t *data, uint8_t len);
bool		sht31_read_temp_hum		(flexcomm_index_list Index);
float		sht31_read_temperature	(flexcomm_index_list Index);
float		sht31_read_humidity		(flexcomm_index_list Index);
#endif


#endif
